<template>
  <el-dropdown @command="handleCommandFn">
    <div>
      <svg-icon icon-class="language" style="color: #fff; font-size: 20px" />
    </div>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="zh" :disabled="'zh' === this.$i18n.locale">中文</el-dropdown-item>
      <el-dropdown-item command="en" :disabled="'en' === this.$i18n.locale">en</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import Cookie from 'js-cookie'
export default {
  methods: {
    handleCommandFn(lang) {
      Cookie.set('language', lang) // 切换多语言
      this.$i18n.locale = lang
      this.$message.success('语言切换成功')
    }
  }
}
</script>

<style>
</style>
